#!/bin/bash
adb shell dd if=/dev/graphics/fb0 of=/data/tmp.img
adb pull /data/tmp.img
len=`ls -l tmp.img | cut -f 5 -d ' '`
echo $len
ioff=0
echo > tmp_rgb.img
convert_rgba_rgb tmp.img tmp_rgb.img
#while [ $ioff -lt $len ];do
#    ooff=`ls -l tmp_rgb.img | cut -f 5 -d ' '`
#    dd if=tmp.img of=tmp_rgb.img skip=$ioff seek=$ooff bs=1 count=3 2>/dev/null
#    ioff=$(($ioff+4))
#    if [ $(($ioff%1024)) -eq 0 ];then
#        echo $ooff
#    fi
#done
dd if=tmp_rgb.img of=tmp_rgb1.img skip=$((800*480*3*0)) bs=1 count=$((800*480*3))
dd if=tmp_rgb.img of=tmp_rgb2.img skip=$((800*480*3*1)) bs=1 count=$((800*480*3))
dd if=tmp_rgb.img of=tmp_rgb3.img skip=$((800*480*3*2)) bs=1 count=$((800*480*3))

convert -depth 8 -size 480x800 rgb:tmp_rgb1.img screenshot1.png
convert -depth 8 -size 480x800 rgb:tmp_rgb2.img screenshot2.png
convert -depth 8 -size 480x800 rgb:tmp_rgb3.img screenshot3.png

display screenshot1.png
display screenshot2.png
display screenshot3.png
